@{
    ViewData["Title"] = "列表";
    Layout = "~/Areas/Manager/Views/Shared/_Layout.cshtml";
}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">留言管理</div>
                <div class="layui-card-body">
                    <div class="layui-row">
                        <div class="layui-form-item">
                            <div class="layui-col-md3" style="padding-left:0">
                                <div class="input-group">
                                    <input type="text" id="keyWords" name="keyWords" placeholder="请输入要搜索的问题" autocomplete="off" class="layui-input">
                                    <span class="input-group-btn">
                                        <button class="layui-btn" id="search">
                                            <i class="layui-icon layui-icon-search"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-btn-container">
                            <div class="layui-btn-group">
                                <button class="layui-btn layui-btn-sm layui-btn-danger" id="deleteAll"><i class="layui-icon">&#xe640;</i>删除</button>
                                <button class="layui-btn layui-btn-sm  layui-bg-orange" id="audit"><i class="layui-icon">&#xe640;</i>审核通过</button>
                                <button class="layui-btn  layui-btn-sm layui-bg-blue" id="noAudit"><i class="layui-icon">&#xe640;</i>审核不通过</button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <table class="layui-table" lay-data="{page:true, id:'list'}" lay-filter="list">
                            <thead>
                                <tr>
                                    <th lay-data="{checkbox:true, fixed: true}"></th>
                                    <th lay-data="{ field: 'nickName',width:150}">留言者</th>
                                    <th lay-data="{ field: 'description',width:300}">留言内容</th>
                                    <th lay-data="{ field: 'createdDate',width:200}">留言时间</th>
                                    <th lay-data="{ field: 'handlerNickName',width:150}">处理人</th>
                                    <th lay-data="{ field: 'handlerDate',width:200}">处理时间</th>
                                    <th lay-data="{ field: 'replyDescription',width:200}">回复内容</th>
                                    <th lay-data="{ field: 'auditStatus',templet: '#auditstatus',width:120}">审核状态</th>
                                    <th lay-data="{ field: 'status',templet: '#state',width:120}">回复状态</th>
                                    <th lay-data="{toolbar:'#tableoption', fixed: 'right',width:90}">操作</th>
                                </tr>
                            </thead>
                        </table>
                        <script type="text/html" id="tableoption">
                            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>回复</a>
                        </script>
                        <script type="text/html" id="state">
                            {{# if(d.status === 0){ }}
                            <span class="layui-badge layui-bg-orange">未处理</span>
                            {{# }else{ }}
                            <span class="layui-badge layui-bg-green">已处理</span>
                            {{# } }}
                        </script>
                        <script type="text/html" id="auditstatus">
                            {{# if(d.auditStatus === 1){ }}
                            <span class="layui-badge layui-bg-orange">通过</span>
                            {{# }else{ }}
                            <span class="layui-badge layui-bg-green">未通过</span>
                            {{# } }}
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section scriptsfeet
    {
    <script type="text/javascript">
        layui.config({
            base: '/layuiadmin/' //自定义模块路径
        }).use(['sykjwh', 'table'], function () {
            var $ = layui.$, sykjwh = layui.sykjwh, table = layui.table;

            //绑定数据
            sykjwh.dataBind('@Url.Action("list", "Guestbook", new { area = Constant.AREAMANAGER })');

           //审核通过
            $("#audit").click(function () {
                sykjwh.batOperate('@Url.Action("Guestbookaudit", "Guestbook", new {area = Constant.AREAMANAGER})', 'id');
            });

             //审核不通过
            $("#noAudit").click(function () {
                sykjwh.batOperate('@Url.Action("Guestbooknoaudit", "Guestbook", new {area = Constant.AREAMANAGER})', 'id');
            });

            //批量删除
            $("#deleteAll").click(function () {
                sykjwh.batOperate('@Url.Action("deleteall", "Guestbook", new { area = Constant.AREAMANAGER })', 'id');
            });

            //监听表格行
            table.on('tool(list)', function (obj) {
                var data = obj.data;//获得当前行数据
                if (obj.event === 'edit') {
                    sykjwh.open('编辑', '@Url.Action("edit", "Guestbook", new { area = Constant.AREAMANAGER })/' + data.id, 700, 400);
                }
            });

            //搜索
            $("#search").click(function () {
                //绑定数据
                sykjwh.dataBind('@Url.Action("list", "Guestbook", new { area = Constant.AREAMANAGER })', {
                    keyWords: $.trim($("#keyWords").val())
                });
            });
        });
    </script>
}